for x in range(i): |
i = int(i) |
arrayToRandom.append(r) |
arrayToRandom = [] |
import random |
r = random.randint(1,9) |
i = input() |
print(arrayToRandom) |
for x in range(i): |
i = int(i) |
    arrayToRandom.append(r) |
arrayToRandom = [] |
import random |
    r = random.randint(1,9) |
i = input() |
print(arrayToRandom) |
1 | import random |
2 | arrayToRandom = [] |
3 | i = input() |
4 | i = int(i) |
5 | for x in range(i): |
6 |     r = random.randint(1,9) |
7 |     arrayToRandom.append(r) |
8 | print(arrayToRandom) |
t = t + arrayToSum[x] |
print(x) |
for x in range(len(arrayToSum)): |
arrayToSum = [3,5,6,6,4,4,5,5,3,5,7,5] |
t = 0 |
    t = t + arrayToSum[x] |
print(x) |
for x in range(len(arrayToSum)): |
arrayToSum = [3,5,6,6,4,4,5,5,3,5,7,5] |
t = 0 |
1 | arrayToSum = [3,5,6,6,4,4,5,5,3,5,7,5] |
2 | t = 0 |
3 | for x in range(len(arrayToSum)): |
4 |     t = t + arrayToSum[x] |
5 | print(x) |
t = t + arrayToSum[x][y] |
for y in range(len(arrayToSum[x])): |
arrayToSum = [[3,5,6],[6,4,4],[5,5,3],[5,7,5]] |
for x in range(len(arrayToSum)): |
t = 0 |
print(t) |
        t = t + arrayToSum[x][y] |
    for y in range(len(arrayToSum[x])): |
arrayToSum = [[3,5,6],[6,4,4],[5,5,3],[5,7,5]] |
for x in range(len(arrayToSum)): |
t = 0 |
print(t) |
1 | arrayToSum = [[3,5,6],[6,4,4],[5,5,3],[5,7,5]] |
2 | t = 0 |
3 | for x in range(len(arrayToSum)): |
4 |     for y in range(len(arrayToSum[x])): |
5 |         t = t + arrayToSum[x][y] |
6 | print(t) |
array1 = [1,2,3,4] |
array2 = [5,6,7,8] |
print(array1) |
array1.append(array2[x]) |
for x in range(len(array2)): |
array1 = [1,2,3,4] |
array2 = [5,6,7,8] |
print(array1) |
    array1.append(array2[x]) |
for x in range(len(array2)): |
1 | array1 = [1,2,3,4] |
2 | array2 = [5,6,7,8] |
3 | for x in range(len(array2)): |
4 |     array1.append(array2[x]) |
5 | print(array1) |
if array2[y] == x: |
found = True |
found = True |
for y in range(len(array1)): |
if found == False: |
for y in range(len(array2)): |
print(arr) |
for x in range(1,101): |
found = False |
if array1[y] == x: |
arr = [] |
arr.append(x) |
        if array2[y] == x: |
            found = True |
            found = True |
    for y in range(len(array1)): |
    if found == False: |
    for y in range(len(array2)): |
print(arr) |
for x in range(1,101): |
    found = False |
        if array1[y] == x: |
arr = [] |
        arr.append(x) |
1 | arr = [] |
2 | for x in range(1,101): |
3 |     found = False |
4 |     for y in range(len(array1)): |
5 |         if array1[y] == x: |
6 |             found = True |
7 |      |
8 |     for y in range(len(array2)): |
9 |         if array2[y] == x: |
10 |             found = True |
11 |     if found == False: |
12 |         arr.append(x) |
13 | print(arr) |
for x in range(1,101): |
found1 = False |
for y in range(len(array1)): |
found2 = False |
arr.append(x) |
if array1[y] == x: |
if found1 == True and found2 == True: |
found = found1 |
for y in range(len(array2)): |
arr = [] |
found2 = True |
if array2[y] == x: |
for x in range(1,101): |
    found1 = False |
    for y in range(len(array1)): |
    found2 = False |
        arr.append(x) |
        if array1[y] == x: |
    if found1 == True and found2 == True: |
            found = found1 |
    for y in range(len(array2)): |
arr = [] |
            found2 = True |
        if array2[y] == x: |
1 | arr = [] |
2 | for x in range(1,101): |
3 |     found1 = False |
4 |     for y in range(len(array1)): |
5 |         if array1[y] == x: |
6 |             found = found1 |
7 | |
8 |     found2 = False |
9 |     for y in range(len(array2)): |
10 |         if array2[y] == x: |
11 |             found2 = True |
12 |              |
13 |     if found1 == True and found2 == True: |
14 |         arr.append(x) |
if array1[x] == array2[y]: |
print(arr) |
for y in range(len(array2)): |
arr = [] |
for x in range(len(array1)): |
arr.append(array1[x]) |
        if array1[x] == array2[y]: |
print(arr) |
    for y in range(len(array2)): |
arr = [] |
for x in range(len(array1)): |
            arr.append(array1[x]) |
1 | arr = [] |
2 | for x in range(len(array1)): |
3 |     for y in range(len(array2)): |
4 |         if array1[x] == array2[y]: |
5 |             arr.append(array1[x]) |
6 | print(arr) |
7 |          |
newDetentions = [["Billy",10],["Billy",10],["Ellie",40],["Jimmy",50],["Jackson",50],["Ellie",40]] |
detentions = [["Billy",40],["John",20],["Jackson",5]] |
detentions[y][1] += sub[1] |
found = False |
detentions.append(sub) |
if detentions[y] == sub[0]: |
for x in range(len(newDetentions)): |
found = True |
print(detentions) |
if found == False: |
for y in range(len(detentions)): |
sub = newDetentions[x] |
newDetentions = [["Billy",10],["Billy",10],["Ellie",40],["Jimmy",50],["Jackson",50],["Ellie",40]] |
detentions = [["Billy",40],["John",20],["Jackson",5]] |
            detentions[y][1] += sub[1] |
    found = False |
        detentions.append(sub) |
        if detentions[y] == sub[0]: |
for x in range(len(newDetentions)): |
            found = True |
print(detentions) |
    if found == False: |
    for y in range(len(detentions)): |
    sub = newDetentions[x] |
1 | detentions = [["Billy",40],["John",20],["Jackson",5]] |
2 | newDetentions = [["Billy",10],["Billy",10],["Ellie",40],["Jimmy",50],["Jackson",50],["Ellie",40]] |
3 | |
4 | for x in range(len(newDetentions)): |
5 |     sub = newDetentions[x] |
6 |     found = False |
7 |     for y in range(len(detentions)): |
8 |         if detentions[y] == sub[0]: |
9 |             detentions[y][1] += sub[1] |
10 |             found = True |
11 |     if found == False: |
12 |         detentions.append(sub) |
13 | print(detentions) |
for y in range(len(soloOnly)): |
print(soloOnly) |
soloOnly.append(name) |
if soloOnly[y] == name: |
names = ["Tim","Matt","Jake","Jake","Tim","Megan","Megan","Rob"] |
found = False |
found = True |
soloOnly = [] |
for x in range(len(names)): |
if found == False: |
name = names[x] |
    for y in range(len(soloOnly)): |
print(soloOnly) |
        soloOnly.append(name) |
        if soloOnly[y] == name: |
names = ["Tim","Matt","Jake","Jake","Tim","Megan","Megan","Rob"] |
    found = False |
            found = True |
soloOnly = [] |
for x in range(len(names)): |
    if found == False: |
    name = names[x] |
1 | names = ["Tim","Matt","Jake","Jake","Tim","Megan","Megan","Rob"] |
2 | soloOnly = [] |
3 | for x in range(len(names)): |
4 |     name = names[x] |
5 |     found = False |
6 |     for y in range(len(soloOnly)): |
7 |         if soloOnly[y] == name: |
8 |             found = True |
9 |     if found == False: |
10 |         soloOnly.append(name) |
11 | print(soloOnly) |
for x in range(len(names)): |
names = ["Tim","Matt","Jake","Jake","Tim","Megan","Megan","Rob"] |
print(soloOnly) |
soloOnly = [] |
if names[x] not in soloOnly: |
soloOnly.append(name) |
for x in range(len(names)): |
names = ["Tim","Matt","Jake","Jake","Tim","Megan","Megan","Rob"] |
print(soloOnly) |
soloOnly = [] |
    if names[x] not in soloOnly: |
        soloOnly.append(name) |
1 | names = ["Tim","Matt","Jake","Jake","Tim","Megan","Megan","Rob"] |
2 | soloOnly = [] |
3 | for x in range(len(names)): |
4 |     if names[x] not in soloOnly: |
5 |         soloOnly.append(name) |
6 | print(soloOnly) |
for y in range(len(suits)): |
print(deck) |
for x in range(1,13): |
suit = suits[y] |
deck = [] |
suits = ["Hearts","Diamonds","Clubs","Spades"] |
deck.append([x,suit]) |
for y in range(len(suits)): |
print(deck) |
    for x in range(1,13): |
    suit = suits[y] |
deck = [] |
suits = ["Hearts","Diamonds","Clubs","Spades"] |
        deck.append([x,suit]) |
1 | deck = [] |
2 | suits = ["Hearts","Diamonds","Clubs","Spades"] |
3 | for y in range(len(suits)): |
4 |     suit = suits[y] |
5 |     for x in range(1,13): |
6 |         deck.append([x,suit]) |
7 | print(deck) |
for x in range(len(arrayToSearch)): |
import json |
break |
if arrayToSearch[x] == 81507: |
arrayToSearch = json.load(json_file) |
print(x+1) |
with open('task8.json') as json_file: |
for x in range(len(arrayToSearch)): |
import json |
        break |
    if arrayToSearch[x] == 81507: |
    arrayToSearch = json.load(json_file) |
        print(x+1) |
with open('task8.json') as json_file: |
1 | import json |
2 | with open('task8.json') as json_file: |
3 |     arrayToSearch = json.load(json_file) |
4 | |
5 | for x in range(len(arrayToSearch)): |
6 |     if arrayToSearch[x] == 81507: |
7 |         print(x+1) |
8 |         break |
arrayToSearch = json.load(json_file) |
arrayToSearch = arrayToSearch[middle+1:] |
break |
if arrayToSearch[middle] == 81507: |
arrayToSearch = arrayToSearch[:middle] |
import json |
else: |
middle = len(arrayToSearch)//2 |
loops = 1 |
print(loops) |
while True: |
loops = loops + 1 |
with open('task8.json') as json_file: |
elif arrayToSearch[middle] > 81507: |
    arrayToSearch = json.load(json_file) |
        arrayToSearch = arrayToSearch[middle+1:] |
        break |
    if arrayToSearch[middle] == 81507: |
        arrayToSearch = arrayToSearch[:middle] |
import json |
    else: |
    middle = len(arrayToSearch)//2 |
loops = 1 |
        print(loops) |
while True: |
    loops = loops + 1 |
with open('task8.json') as json_file: |
    elif arrayToSearch[middle] > 81507: |
1 | import json |
2 | with open('task8.json') as json_file: |
3 |     arrayToSearch = json.load(json_file) |
4 | |
5 | loops = 1 |
6 | while True: |
7 |     middle = len(arrayToSearch)//2 |
8 |     if arrayToSearch[middle] == 81507: |
9 |         print(loops) |
10 |         break |
11 |     elif arrayToSearch[middle] > 81507: |
12 |         arrayToSearch = arrayToSearch[:middle] |
13 |     else: |
14 |         arrayToSearch = arrayToSearch[middle+1:] |
15 |     loops = loops + 1 |
[" "," "," "," "," "," "," "," "," "," "," "], |
time.sleep(1) |
animationArray.pop(l) |
r = str(r) |
[" "," "," "," "," "," "," "," "," "," "," "], |
while True: |
[" "," "," "," "," "," "," "," "," "," "," "], |
import random |
[" "," "," "," "," "," "," "," "," "," "," "]] |
os.system('cls') |
animationArray = [ |
import os |
r = random.randint(0,1) |
l = len(animationArray)-1 |
for x in range(11): |
sub.append(r) |
animationArray.insert(0,sub) |
[" "," "," "," "," "," "," "," "," "," "," "], |
print(" ".join(animationArray[x])) |
[" "," "," "," "," "," "," "," "," "," "," "], |
for x in range(11): |
[" "," "," "," "," "," "," "," "," "," "," "], |
[" "," "," "," "," "," "," "," "," "," "," "], |
import time |
[" "," "," "," "," "," "," "," "," "," "," "], |
[" "," "," "," "," "," "," "," "," "," "," "], |
[" "," "," "," "," "," "," "," "," "," "," "], |
sub = [] |
[" "," "," "," "," "," "," "," "," "," "," "], |
    time.sleep(1) |
    animationArray.pop(l) |
        r = str(r) |
[" "," "," "," "," "," "," "," "," "," "," "], |
while True: |
[" "," "," "," "," "," "," "," "," "," "," "], |
import random |
[" "," "," "," "," "," "," "," "," "," "," "]] |
    os.system('cls') |
animationArray = [ |
import os |
        r = random.randint(0,1) |
    l = len(animationArray)-1 |
    for x in range(11): |
        sub.append(r) |
    animationArray.insert(0,sub) |
[" "," "," "," "," "," "," "," "," "," "," "], |
        print(" ".join(animationArray[x])) |
[" "," "," "," "," "," "," "," "," "," "," "], |
    for x in range(11): |
[" "," "," "," "," "," "," "," "," "," "," "], |
[" "," "," "," "," "," "," "," "," "," "," "], |
import time |
[" "," "," "," "," "," "," "," "," "," "," "], |
[" "," "," "," "," "," "," "," "," "," "," "], |
[" "," "," "," "," "," "," "," "," "," "," "], |
    sub = [] |
1 | animationArray = [ |
2 | [" "," "," "," "," "," "," "," "," "," "," "], |
3 | [" "," "," "," "," "," "," "," "," "," "," "], |
4 | [" "," "," "," "," "," "," "," "," "," "," "], |
5 | [" "," "," "," "," "," "," "," "," "," "," "], |
6 | [" "," "," "," "," "," "," "," "," "," "," "], |
7 | [" "," "," "," "," "," "," "," "," "," "," "], |
8 | [" "," "," "," "," "," "," "," "," "," "," "], |
9 | [" "," "," "," "," "," "," "," "," "," "," "], |
10 | [" "," "," "," "," "," "," "," "," "," "," "], |
11 | [" "," "," "," "," "," "," "," "," "," "," "], |
12 | [" "," "," "," "," "," "," "," "," "," "," "]] |
13 | |
14 | import time |
15 | import os |
16 | import random |
17 | |
18 | while True: |
19 |     sub = [] |
20 |     for x in range(11): |
21 |         r = random.randint(0,1) |
22 |         r = str(r) |
23 |         sub.append(r) |
24 |          |
25 |     animationArray.insert(0,sub) |
26 |     l = len(animationArray)-1 |
27 |     animationArray.pop(l) |
28 |     for x in range(11): |
29 |         print(" ".join(animationArray[x])) |
30 |     time.sleep(1) |
31 |     os.system('cls') |
time.sleep(3) |
print("Adding " + animal) |
import random |
break |
stacking.append(animal + " 2") |
animal = stacking[x] |
def removeItem(arr,item): |
r = random.randint(0,len(animals)-1) |
animals = ["Fish","Cow","Octopus","Squid","Rat"] |
else: |
stacking.append(values[0] + " " + str(int(values[1]) + 1)) |
return new |
broken = True |
animal = animals[r] |
values = animal.split(" ") |
stacking.append(animal) |
stacking = removeItem(stacking,animal) |
if broken == False: |
while True: |
if stacking.count(animal) == 3: |
stacking = [] |
print(stacking) |
break |
while True: |
import time |
for x in range(len(arr)): |
if arr[x] != item: |
new = [] |
new.append(arr[x]) |
for x in range(len(stacking)): |
broken = False |
if " " in animal: |
    time.sleep(3) |
    print("Adding " + animal) |
import random |
            break |
                    stacking.append(animal + " 2") |
            animal = stacking[x] |
def removeItem(arr,item): |
    r = random.randint(0,len(animals)-1) |
animals = ["Fish","Cow","Octopus","Squid","Rat"] |
                else: |
                    stacking.append(values[0] + " " + str(int(values[1]) + 1)) |
    return new |
                broken = True |
    animal = animals[r] |
                    values = animal.split(" ") |
    stacking.append(animal) |
                stacking = removeItem(stacking,animal) |
        if broken == False: |
    while True: |
            if stacking.count(animal) == 3: |
stacking = [] |
    print(stacking) |
                break |
while True: |
import time |
    for x in range(len(arr)): |
        if arr[x] != item: |
    new = [] |
            new.append(arr[x]) |
        for x in range(len(stacking)): |
        broken = False |
                if " " in animal: |
1 | import random |
2 | import time |
3 | |
4 | def removeItem(arr,item): |
5 |     new = [] |
6 |     for x in range(len(arr)): |
7 |         if arr[x] != item: |
8 |             new.append(arr[x]) |
9 |     return new |
10 | |
11 | animals = ["Fish","Cow","Octopus","Squid","Rat"] |
12 | stacking = [] |
13 | while True: |
14 |     r = random.randint(0,len(animals)-1) |
15 |     animal = animals[r] |
16 |     print("Adding " + animal) |
17 |     stacking.append(animal) |
18 |     while True: |
19 |         broken = False |
20 |         for x in range(len(stacking)): |
21 |             animal = stacking[x] |
22 |             if stacking.count(animal) == 3: |
23 |                 stacking = removeItem(stacking,animal) |
24 |                 if " " in animal: |
25 |                     values = animal.split(" ") |
26 |                     stacking.append(values[0] + " " + str(int(values[1]) + 1)) |
27 |                 else: |
28 |                     stacking.append(animal + " 2") |
29 |                 broken = True |
30 |                 break |
31 |         if broken == False: |
32 |             break |
33 |     print(stacking) |
34 |     time.sleep(3) |
35 |      |
36 |      |
37 |          |
38 | |
39 | |
40 |      |
41 |      |